package com.dong.basic.dto;


import com.dong.basic.enums.OrderStatusEnum;

import com.dong.basic.po.OrderDetailPO;
import lombok.*;

import java.math.BigDecimal;
@Getter
@ToString
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class OrderMessageDTO {
    /**
     * 订单编号
     */
    private Integer orderId;
    /**
     * 订单状态
     */
    private OrderStatusEnum orderStats;
    /**
     * 价格
     */
    private BigDecimal price;
    /**
     * 骑手编号
     */
    private Integer  deliverymanId;
    /**
     * 商品编号
     */
    private Integer productId;
    /**
     * 用户编号
     */
    private Integer accountId;
    /**
     * 结算id
     */
    private Integer settlementId;
    /**
     * 积分结算id
     */
    private Integer rewardId;

    /**
     * 积分奖励数量
     */
    private Integer rewardAmount;
    /**
     * 确认
     */
    private Boolean confirmed;

    public static OrderMessageDTO createFromPo4Creating(OrderDetailPO po) {
        OrderMessageDTO messageDTO = new OrderMessageDTO();
        messageDTO.setAccountId(po.getAccountId());
        messageDTO.setProductId(po.getProductId());
        messageDTO.setPrice(po.getPrice());
        messageDTO.setOrderId(po.getId());
        messageDTO.setOrderStats(po.getStatus());
        messageDTO.setConfirmed(true);
        return messageDTO;

    }
}
